package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: DishFlavorMapper
 * Package: com.sky.mapper
 * Description:
 *
 * @Author: qmh
 * @Create: 2024/12/24 - 9:02
 * @Version: v1.0
 */
@Mapper
public interface DishFlavorMapper {


    void insertBatch(List<DishFlavor> flavors);

    /**
     * 根据菜品id删除相关口味数据
     * @param id
     */
    @Delete("delete from dish_flavor where dish_id = #{dish_id}")
    void deleteByDishId(@Param("dish_id") Long id);

    /**
     * 根据菜品id查询对应口味
     * @param id
     * @return
     */
    @Select("select * from dish_flavor where dish_id = #{id}")
    List<DishFlavor> getByDishId(Long id);
}